/**
 * 护理员统计
 */
$(function(){
    showstaff();
    let url ='../statistics/listStaffyear'
    function showstaff(status){
        layui.use('table', function(){
            var table = layui.table;

            //数据表格渲染
            var tableIns=table.render({
                elem: '#showstaff'
                ,id:'staff'
                ,url:'../statistics/listStaffmonth6'
                ,height:390
                ,cellMinWidth: 80//全局定义常规单元格的最小宽度，layui 2.2.1 新增

                ,parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
                    console.log(res)

                    return {
                        code:0,
                        "count": res.length, //解析数据长度
                        "data": res, //解析数据列表
                    }
                }
                ,cols: [[
                    {field:'time',width:200,title:'月份',align:'center',sort:true,fixed:'left'},
                    {field:'youxiaodaigang',width:200,title:'有效待岗',align: 'center'},
                    {field:'youxiaozaigang',width:200,title:'有效在岗',align: 'center'},
                    {field:'hg_wuxiaozhuanchu',width:200,title:'无效转出',align: 'center'},
                ]]
            });

            var tableIns=table.render({
                elem: '#showyear'
                ,id:'year'
                ,url:url
                ,height:390
                ,cellMinWidth: 80//全局定义常规单元格的最小宽度，layui 2.2.1 新增

                ,parseData: function(res) { //将原始数据解析成 table 组件所规定的数据
                    console.log(res)
                    return {
                        code:0,

                        "count": res.length, //解析数据长度
                        "data": res, //解析数据列表
                    }
                }
                ,cols: [[
                    {field:'time',width:200,title:'月份',align:'center',sort:true,fixed:'left'},
                    {field:'youxiaodaigang',width:200,title:'有效待岗',align: 'center'},
                    {field:'youxiaozaigang',width:200,title:'有效在岗',align: 'center'},
                    {field:'hg_wuxiaozhuanchu',width:200,title:'无效转出',align: 'center'},
                ]]
            });


        });

    }
    $(".searchBtn").click(function(){
        console.log($("#yearSearch").val())
        if ($("#yearSearch").val()){
            url='../statistics/listStaffyear?year='+$("#yearSearch").val()
            showstaff()
        }else{
            layer.msg('请选择年份')
        }

    });
});


